// 封装获取部门负责人的接口
import instance from "@/utils/request";

// 获取员工简单列表
export function getUserSimleApi() {
  return instance({
    url: "/sys/user/simple"
  });
}

// 获取员工列表
export function getUserListApi(params) {
  return instance({
    url: "/sys/user",
    params
  });
}

// 添加员工
export function addUserApi(data) {
  return instance({
    url: "/sys/user",
    method: "post",
    data
  });
}

// 批量导入员工
export function addAllUserApi(data) {
  return instance({
    url: "sys/user/batch",
    method: "post",
    data
  });
}

// 根据id获取员工基本信息
export function getUserInfoApi(id) {
  return instance({
    url: `/sys/user/${id}`
  });
}

// 保存员工基本信息
export function updateUserInfoApi(data) {
  return instance({
    url: `/sys/user/${data.id}`,
    method: "put",
    data
  });
}

// 获取员工的个人信息
export function getPersonInfoAPi(id) {
  return instance({
    url: `/employees/${id}/personalInfo`
  });
}

// 获取员工的岗位信息
export function getJobInfoApi(id) {
  return instance({
    url: `/employees/${id}/jobs`
  });
}

// 给员工分配角色
export function setUserRoleApi(data) {
  return instance({
    url: "/sys/user/assignRoles",
    method: "put",
    data
  });
}
